import App from '@/common/js/app.js'

const api_gethealthcard = function(healthCode) {
	return new Promise((resolve, reject) => {
		App._post_form2("entry/wxapp/apihealthcard.gethealthcard", {
			code: healthCode
		}, (res) => {
			resolve(res)
		})
	})
}

const api_createprofile = function(openid, formData) {
	return new Promise((resolve, reject) => {
		App._post_form2("entry/wxapp/apipatient.createprofile", {
			openid: openid,
			form: formData
		}, (res) => {
			resolve(res)
		})
	})
}

const api_registerHealthCardPreAuth = function(wechatCode) {
	return new Promise((resolve, reject) => {
		App._post_form2("entry/wxapp/apihealthcard.registerhealthcardpreauth", {
			"wechatCode": wechatCode,
			"patientType": 0,
			"successRedirectUrl": "mini:/path/to/isvpage?healthCode=${healthCode}",
			"failRedirectUrl": "mini:/path/to/isvpage?regInfoCode=${regInfoCode}",
			"userFormPageUrl": "mini:/pagesB/healthCard/healthLogin?authCode=${authCode}",
			"faceUrl": "/pagesB/healthCard/facePage",
			"verifyFailRedirectUrl": "mini:/path/to/isvpage",
			"domainChannel": 3
		}, (res) => {
			resolve(res)
		})
	})
}


export default {
	api_gethealthcard,
	api_createprofile,
	api_registerHealthCardPreAuth
}